{include file='imobile_header.tpl'}

<div id="topbar">
	<div id="leftnav"> 
		<a href="user_home.php"><img alt="home" src="./include/imobile/iwebkit/images/home.png" /></a>
		<a  href="javascript:history.go(-1);">{lang_print id=11340015}</a>
	</div> 
	<div id="title"> 
		{lang_print id=11340022}
	</div> 
    {if ($user->level_info.level_message_allow == 2 || ($user->level_info.level_message_allow == 1 && $is_friend)) && $owner->level_info.level_message_allow != 0}
      <div id="bluerightbutton">
	        <a href="user_messages_new.php?to_user={$owner->user_displayname|escape:url}&to_id={$owner->user_info.user_username}">{lang_print id=11340072}</a>
      </div>
    {/if}
</div>

<div id="tributton"> 
	<div class="links"> 
		<a href="javascript: iMobile_profileSwitchTab('profile');">{lang_print id=11340101}</a><a href="javascript: iMobile_profileSwitchTab('comments');">{lang_print id=11340102}</a><a href="javascript: iMobile_profileSwitchTab('friends');">{lang_print id=11340103}</a>
	</div> 
</div> 

<div id="content">

	<div id="profile_overview">
		<img src="{$owner->user_photo("./images/nophoto.gif")}" width="90" />
		<div>
			<span class="name">{$owner->user_displayname}</span>
			<span class="status">{$owner->user_info.user_status}</span>
		</div>
		
	</div>
	<div style="clear: both"></div>
	

    
	<div id="profile_profile" style="display: {if empty($v) || $v == "profile"}block{else}none{/if}">
      {* SHOW PROFILE CATS AND FIELDS *}
      {section name=cat_loop loop=$cats}
        {section name=subcat_loop loop=$cats[cat_loop].subcats}
          <span class="graytitle">{lang_print id=$cats[cat_loop].subcats[subcat_loop].subcat_title}</span>   
          <ul class="pageitem">
            {* LOOP THROUGH FIELDS IN TAB, ONLY SHOW FIELDS THAT HAVE BEEN FILLED IN *}
            {section name=field_loop loop=$cats[cat_loop].subcats[subcat_loop].fields}
              <li class="key_value">
                <span class="key">{lang_print id=$cats[cat_loop].subcats[subcat_loop].fields[field_loop].field_title}:</span>
              	<span class="value">{$cats[cat_loop].subcats[subcat_loop].fields[field_loop].field_value_formatted}
                {if $cats[cat_loop].subcats[subcat_loop].fields[field_loop].field_special == 1 && $cats[cat_loop].subcats[subcat_loop].fields[field_loop].field_value|substr:0:4 != "0000"} ({lang_sprintf id=852 1=$datetime->age($cats[cat_loop].subcats[subcat_loop].fields[field_loop].field_value)}){/if}
                </span>
              </li>
            {/section}
          </ul>
          
        {/section}
      {/section}
      {* END PROFILE TABS AND FIELDS *}
      
		<span class="graytitle">{lang_print id=11340034}</span> 
		<ul class="pageitem">
			  {* SHOW PUBLIC VERSION OF ACTIVITY LIST *}  
			  {if $actions|@count > 0}
			      {section name=actions_loop loop=$actions max=10}
			        {assign var='action_date' value=$datetime->time_since($actions[actions_loop].action_date)}
			        <li class="feed">
			           <img src='./images/icons/{$actions[actions_loop].action_icon}' border='0' class='icon' alt='' />
			           <div class="action">
			            <span>
			            {lang_sprintf assign=action_text id=$actions[actions_loop].action_text args=$actions[actions_loop].action_vars}
	            	    {$action_text|replace:"[media]":$action_media|choptext:50:"<br>"}
	            	    </span>
	            	    <span class="date">{lang_sprintf id=$action_date[0] 1=$action_date[1]}</span>
	            	   </div>
			        </li>
			      {/section}
			  {/if}
		</ul>
      
      
	</div>
	<!-- /profile_info -->

	<div id="profile_comments" style="display: {if $v == "comments"}block{else}none{/if}">
		
		<span class="graytitle">{lang_sprintf id=11340035  1=$total_comments}
			
		</span>
		<ul class="pageitem">
		{if $allowed_to_comment && $user->user_exists}
			<li class="feed">
				<img src='./images/icons/action_postcomment.gif' border='0' class='icon'/ >
				<div class="action"><a href="javascript: iMobile_toggle('#post_comment_form');" style="color: #666; font-style: italic;">{lang_print id=11340036}</a></div>
			</li>

			<li class="textbox" id="post_comment_form" style="display: none;">
				<form action="imobile.php" method="POST" onSubmit="return iMobile_postComment();" name="comment_form"><input id="submit" type="hidden" />
				<textarea id="comment_body" name="comment_body" rows="4"></textarea>
				<input name="submit" type="submit" value="Post Comment" class="iPush" />

				<input name="task" value="user_post_comment" type="hidden">
				<input name="type" value="profile" type="hidden">
				<input name="iden" value="user_id" type="hidden">
				<input name="value" value="{$owner->user_info.user_id}" type="hidden">
				<input name="user" value="{$owner->user_info.user_username}" type="hidden">
				<input name="tab" value="users" type="hidden">
				<input name="col" value="user" type="hidden">
				
				</form>
			</li>
		{/if}	
		{foreach from=$comments item=comment_data}
	        <li class="uitem">
	           <img src='{$comment_data.comment_author->user_photo('./images/nophoto.gif')}' border='0' class='icon' alt='' />
	           <div class="data">
	            	<span class="name"><a href="{$url->url_create('profile',$comment_data.comment_author->user_info.user_username)}">{$comment_data.comment_author->user_displayname}</a></span>
	            	<span class="comment">{$comment_data.comment_body}</span>
	                <span class="date">{$datetime->cdate("`$setting.setting_dateformat` `$setting.setting_timeformat`", $datetime->timezone($comment_data.comment_date, $global_timezone))}</span>
	           </div>
	        </li>
		{/foreach} 
        </ul>
	</div>
	<!-- /profile_activity -->

	
	<div id="profile_friends" style="display: {if $v == "friends"}block{else}none{/if}">
	
		<span class="graytitle">{lang_sprintf id=11340037  1=$total_friends}</span> 
        {* LOOP THROUGH FRIENDS *}
        <ul class="pageitem">
        {section name=friend_loop loop=$friends}
          <li class="menu">
        	<a href='{$url->url_create('profile',$friends[friend_loop]->user_info.user_username)}'>
        	<img src='{$friends[friend_loop]->user_photo("./images/nophoto.gif", true)}' width='60' height='60' border='0' alt="{lang_sprintf id=509 1=$friends[friend_loop]->user_displayname_short}">
        	<span class="name">{$friends[friend_loop]->user_displayname}</span>
        	<span class="arrow"></span>
        	</a>
          </li>
        {/section}
        </ul>

	</div>
	

</div>

{include file='imobile_footer.tpl'}
